﻿<%@ Page Title="Tin tức - Tiếng Nhật Thật Dễ" Language="C#" MasterPageFile="~/masterpagecuatui.Master" AutoEventWireup="true" CodeBehind="News.aspx.cs" Inherits="SQT.tracnghiem.Default" %>

<%@ Import Namespace="DataAccess" %>
<%@ Register Src="~/BaiViet/Left_searchmenupage.ascx" TagPrefix="uc1" TagName="Left_searchmenupage" %>
<%@ Register Src="~/BaiViet/Right_hotestpost.ascx" TagPrefix="uc1" TagName="Right_hotestpost" %>
<%@ Register Src="~/BaiViet/Right_newestpost.ascx" TagPrefix="uc1" TagName="Right_newestpost" %>



<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="Scripts/jssor.slider-21.1.5.mini.js"></script>
    <script src="Scripts/slideup_news.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <%
        var get_top = (from p in new TblNewsController().FetchAll().Where(x => x.NewsTop == true && x.NewsActive == true && x.NewsDelete == false) orderby p.NewsDate descending select p);
    %>
    <div class="page-main-content w3-row">
        <div class="news-page">
            <div id="myCarousel" class="carousel slide w3-display-container" data-ride="carousel">
                <!-- Indicators -->
                <%if (get_top.ToList().Count != 0)
                  { %>
                <ol class="carousel-indicators w3-hide-small w3-hide-medium">

                    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                    <%for (int i = 1; i < get_top.ToList().Count; i++)
                      { %>
                    <li data-target="#myCarousel" data-slide-to="<%=i %>"></li>
                    <%} %>
                </ol>
                <!-- Wrapper for slides -->
                <div data-wow-delay="1s" class="wow fadeInUp carousel-inner news-big-slide" role="listbox">
                    <div class="item active w3-display-container">
                        <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_top.ToList()[0].NewsTitle)) %>-<%=get_top.ToList()[0].NewsId %>">
                            <img src="/Content/newsdata/avatar/<%=get_top.ToList()[0].NewsImages %>" alt="slide image" class="news-categories-slide-img" /></a>
                        <div class="carousel-caption w3-display-bottommiddle">
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_top.ToList()[0].NewsTitle)) %>-<%=get_top.ToList()[0].NewsId %>" class="w3-xlarge w3-hide-small"><%=get_top.ToList()[0].NewsTitle %></a>
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_top.ToList()[0].NewsTitle)) %>-<%=get_top.ToList()[0].NewsId %>" class="w3-hide-medium w3-hide-large"><%=get_top.ToList()[0].NewsTitle %></a>
                        </div>
                    </div>
                    <%for (int i = 1; i < get_top.ToList().Count; i++)
                      { %>
                    <div class="item w3-display-container">
                        <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_top.ToList()[i].NewsTitle)) %>-<%=get_top.ToList()[i].NewsId %>">
                            <img src="/Content/newsdata/avatar/<%=get_top.ToList()[i].NewsImages %>" alt="slide image" class="news-categories-slide-img" /></a>
                        <div class="carousel-caption w3-display-bottommiddle">
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_top.ToList()[i].NewsTitle)) %>-<%=get_top.ToList()[i].NewsId %>" class="w3-xlarge w3-hide-small"><%=get_top.ToList()[i].NewsTitle %></a>
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_top.ToList()[i].NewsTitle)) %>-<%=get_top.ToList()[i].NewsId %>" class="w3-hide-medium w3-hide-large"><%=get_top.ToList()[i].NewsTitle %></a>
                        </div>
                    </div>
                    <%} %>
                </div>
                <%}
                  else
                  {
                      var get_new_news = (from p in new TblNewsController().FetchAll().Where(x => x.NewsDelete == false && x.NewsActive == true) orderby p.NewsDate descending select p).Take(4);
                %>
                <ol class="carousel-indicators w3-hide-small w3-hide-medium">

                    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                    <%for (int i = 1; i < get_new_news.ToList().Count; i++)
                      { %>
                    <li data-target="#myCarousel" data-slide-to="<%=i %>"></li>
                    <%} %>
                </ol>
                <!-- Wrapper for slides -->
                <div class="carousel-inner news-big-slide" role="listbox">
                    <div class="item active w3-display-container">
                        <a href="../bai-viet/<%=convertToUrl(get_new_news.ToList()[0].NewsTitle) %>-<%=get_new_news.ToList()[0].NewsId %>">
                            <img src="/Content/newsdata/avatar/<%=get_new_news.ToList()[0].NewsImages %>" alt="slide image" class="news-categories-slide-img" /></a>
                        <div class="carousel-caption w3-display-bottommiddle">
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_new_news.ToList()[0].NewsTitle)) %>-<%=get_new_news.ToList()[0].NewsId %>" class="w3-xlarge w3-hide-small"><%=get_new_news.ToList()[0].NewsTitle %></a>
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_new_news.ToList()[0].NewsTitle)) %>-<%=get_new_news.ToList()[0].NewsId %>" class="w3-hide-medium w3-hide-large"><%=get_new_news.ToList()[0].NewsTitle %></a>
                        </div>
                    </div>
                    <%for (int i = 1; i < get_new_news.ToList().Count; i++)
                      { %>
                    <div class="item w3-display-container">
                        <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_new_news.ToList()[i].NewsTitle)) %>-<%=get_new_news.ToList()[i].NewsId %>">
                            <img src="/Content/newsdata/avatar/<%=get_new_news.ToList()[i].NewsImages %>" alt="slide image" class="news-categories-slide-img" /></a>
                        <div class="carousel-caption w3-display-bottommiddle">
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_new_news.ToList()[i].NewsTitle)) %>-<%=get_new_news.ToList()[i].NewsId %>" class="w3-xlarge w3-hide-small"><%=get_new_news.ToList()[i].NewsTitle %></a>
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_new_news.ToList()[i].NewsTitle)) %>-<%=get_new_news.ToList()[i].NewsId %>" class="w3-hide-medium w3-hide-large"><%=get_new_news.ToList()[i].NewsTitle %></a>
                        </div>
                    </div>
                    <%} %>
                </div>
                <%} %>
                <!-- Left and right controls -->
                <div class="w3-display-middle">
                    <a class="left carousel-control w3-jumbo w3-hide-small" href="#myCarousel" role="button" data-slide="prev">
                        <i class="slide-btn fa fa-angle-left" aria-hidden="true"></i>
                    </a>
                    <a class="right carousel-control w3-jumbo w3-hide-small" href="#myCarousel" role="button" data-slide="next">
                        <i class="slide-btn fa fa-angle-right" aria-hidden="true"></i>
                    </a>
                    <a class="left carousel-control w3-xxlarge w3-hide-large w3-hide-medium" href="#myCarousel" role="button" data-slide="prev">
                        <i class="slide-btn fa fa-angle-left" aria-hidden="true"></i>
                    </a>
                    <a class="right carousel-control w3-xxlarge w3-hide-large w3-hide-medium" href="#myCarousel" role="button" data-slide="next">
                        <i class="slide-btn fa fa-angle-right" aria-hidden="true"></i>
                    </a>
                </div>
            </div>
            <div id="news-main-content" class="w3-row w3-padding">
                <div id="news-menu" class="w3-col l2">
                    <uc1:Left_searchmenupage runat="server" ID="Left_searchmenupage" />
                </div>
                <div class="w3-col l7 w3-padding-left">
                    <%var get_cate = (from p in new TblNewsCategoryController().FetchAll().Where(x => x.CatDelete == false) orderby p.CatIndex ascending select p);
                      foreach (TblNewsCategory cate in get_cate)
                      {
                          var get_some_news = (from p in new TblNewsController().FetchAll().Where(x => x.NewsCategory == cate.CatId && x.NewsActive == true && x.NewsDelete == false) orderby p.NewsDate descending select p).Take(5);
                          if (get_some_news.ToList().Count > 0)
                          {
                              string time = DateTime.Parse(get_some_news.ToList()[0].NewsDate.ToString()).Day.ToString() + "/" + DateTime.Parse(get_some_news.ToList()[0].NewsDate.ToString()).Month.ToString() + "/" + DateTime.Parse(get_some_news.ToList()[0].NewsDate.ToString()).Year.ToString();
                    %>
                    <div class="w3-row w3-margin-bottom">
                        <header data-wow-offset="200" class="wow fadeInRight news-cate-header w3-border-teal"><a href="/danh-muc/<%=convertToUrl(convertToUnSign(cate.CatName)) + '-' + cate.CatId.ToString() %>" class="w3-btn w3-teal"><%=cate.CatName %></a></header>
                        <div data-wow-offset="200" class="wow fadeInUp news-first-post w3-row w3-margin-top">
                            <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_some_news.ToList()[0].NewsTitle)) %>-<%=get_some_news.ToList()[0].NewsId %>">
                                <img src="Content/Newsdata/avatar/<%=get_some_news.ToList()[0].NewsImages %>" class="w3-twothird w3-padding-right" /></a>
                            <div class="w3-third">
                                <div class="news-hot-title"><a class="w3-hover-text-teal" href="../bai-viet/<%=convertToUrl(convertToUnSign(get_some_news.ToList()[0].NewsTitle)) %>-<%=get_some_news.ToList()[0].NewsId %>"><%=get_some_news.ToList()[0].NewsTitle %></a></div>
                                <p class="w3-small"><span class="w3-text-grey"><%=time %></span><span> - </span><span class="w3-text-teal"><%=get_some_news.ToList()[0].NewsViewed %> lượt xem</span></p>
                                <div class="news-flash-100"><%=limitReview(get_some_news.ToList()[0].NewsReview) %></div>
                            </div>
                        </div>
                        <div class="w3-row">
                            <%for (int i = 1; i < get_some_news.ToList().Count; i++)
                              {
                                  time = DateTime.Parse(get_some_news.ToList()[i].NewsDate.ToString()).Day.ToString() + "/" + DateTime.Parse(get_some_news.ToList()[i].NewsDate.ToString()).Month.ToString() + "/" + DateTime.Parse(get_some_news.ToList()[i].NewsDate.ToString()).Year.ToString();
                            %>
                            <div data-wow-offset="200" class="wow fadeInUp news-post w3-margin-top w3-half w3-padding-right w3-center">
                                <a href="../bai-viet/<%=convertToUrl(convertToUnSign(get_some_news.ToList()[i].NewsTitle)) %>-<%=get_some_news.ToList()[i].NewsId %>">
                                    <img src="Content/Newsdata/avatar/<%=get_some_news.ToList()[i].NewsImages %>" /></a>
                                <div class="news-hot-title"><a class="w3-hover-text-teal" href="../bai-viet/<%=convertToUrl(convertToUnSign(get_some_news.ToList()[i].NewsTitle)) %>-<%=get_some_news.ToList()[i].NewsId %>"><%=get_some_news.ToList()[i].NewsTitle %></a></div>
                                <div class="w3-small"><span class="w3-text-grey"><%=time %></span><span> - </span><span class="w3-text-teal"><%=get_some_news.ToList()[i].NewsViewed %> lượt xem</span></div>
                            </div>
                            <%} %>
                        </div>
                        <div class="w3-row w3-padding w3-center"><a href="/danh-muc/<%=convertToUrl(convertToUnSign(cate.CatName)) + '-' + cate.CatId.ToString() %>" data-wow-offset="200" class="wow bounceIn news-view-all-btn w3-btn w3-teal hvr-icon-forward">Xem thêm</a></div>
                    </div>

                    <%}
                      }%>
                </div>
                <%var get_news_newest = (from p in new TblNewsController().FetchAll().Where(x => x.NewsDelete == false && x.NewsActive == true) orderby p.NewsDate descending select p); %>
                <div class="w3-quarter w3-padding-left">
                    <uc1:Right_newestpost runat="server" ID="Right_newestpost" />
                    <uc1:Right_hotestpost runat="server" ID="Right_hotestpost" />
                </div>
            </div>
        </div>
    </div>
    <script>
        new WOW().init();
    </script>
    <script src="Scripts/javacuatui5.js"></script>
</asp:Content>
